<!-- 图片控件设置面板 -->
<template>
    <el-tabs modelValue="widget" stretch>
        <el-tab-pane :label="`${widget.widgetData.component.title}组件`" name="widget">
            <el-scrollbar>
                <!-- 组件风格 -->
                <row-component-mode :widget="widget" />
                
                <el-collapse modelValue="1">
                    <el-collapse-item title="上传图片" name="1">
                        <layout-pane label="图片">
                            <si-image-picker
                                v-if="!widget.widgetData.eles[':content']"
                                v-model="widget.widgetData.eles.content"
                                type="image"
                                :show-label="false"
                                :size="100"
                                style="margin-bottom: 10px;"
                            />
                            
                            <el-input v-model="widget.widgetData.eles.content" placeholder="图片地址" />
                        </layout-pane>

                        <el-divider></el-divider>
                        <layout-pane label="颜色">
                            <si-color-picker
                                v-model="widget.widgetData.eles.style['background-color']"
                                label="背景色"
                                show-alpha
                            />
                        </layout-pane>
                    </el-collapse-item>
                </el-collapse>

                <!-- 组件名称 -->
                <row-component-name :widget="widget" />
                
                <!-- 点击事件 -->
                <row-click-event :widget="widget" />
                
                <!-- 元素可见设置 -->
                <row-element-visible :widget="widget" />
            </el-scrollbar>
        </el-tab-pane>

        <el-tab-pane label="组件样式" name="style">
            <el-scrollbar>
                <el-collapse modelValue="1">
                    <el-collapse-item title="组件设置" name="1">
                        <!-- 大小 -->
                        <row-size :widget="widget" />

                        <!-- 圆角 -->
                        <el-divider></el-divider>
                        <row-border-radius :widget="widget" />

                        <!-- 位置 -->
                        <el-divider></el-divider>
                        <row-position :widget="widget" />

                        <!-- 透明 -->
                        <el-divider></el-divider>
                        <row-opacity :widget="widget" />
                        
                        <!-- 边框 -->
                        <el-divider></el-divider>
                        <row-border :widget="widget" />
                        
                        <!-- 边框阴影 -->
                        <el-divider></el-divider>
                        <row-shadow type="box-shadow" :widget="widget" />
                    </el-collapse-item>
                </el-collapse>
            </el-scrollbar>
        </el-tab-pane>
    </el-tabs>
</template>

<script>
import { defineComponent, toRefs } from 'vue'
import LayoutPane from '@/components/setting-pane/layout-pane'
import {
    SiImagePicker,
    SiColorPicker
} from '@/components/setting-pane/setting-item'
import {
    RowSize,
    RowShadow,
    RowPosition,
    RowBorder,
    RowOpacity,
    RowBorderRadius,
    RowClickEvent,
    RowComponentName,
    RowComponentMode,
    RowElementVisible
} from '../../widget-setting-row'
export default defineComponent({
    name: 'PictureSetting',
    components: {
        LayoutPane,

        SiImagePicker,
        SiColorPicker,

        RowSize,
        RowShadow,
        RowPosition,
        RowBorder,
        RowOpacity,
        RowBorderRadius,
        RowClickEvent,
        RowComponentName,
        RowComponentMode,
        RowElementVisible
    },
    props: {
        widget: {
            type: Object,
            default: () => ({})
        }
    },
    setup(props) {
        const { widget } = toRefs(props)

        return {
            widget
        }
    }
})
</script>
